//
//  HMStatus.swift
//  weibo10
//
//  Created by mac on 15/10/21.
//  Copyright © 2015年 itheima. All rights reserved.
//

import UIKit

class HMStatus: NSObject {
    /// 微博ID
    var id: Int = 0
    /// 微博创建时间
    var created_at: String?
    /// 微博信息内容
    var text: String?
    /// 微博来源
    var source: String?
    /// 用户模型
    var user: HMUser?
    /// 缩略图数组
    var pic_urls: [[String: String]]?
    /// 被转发微博的原微博信息字段
    var retweeted_status: HMStatus?
    
    init(dict:[String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
        
    }
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user"{
            if let dict = value as? [String: AnyObject] {
                user = HMUser(dict: dict)
            }
            return
        }
        if key == "retweeted_status" {
            if let dict = value as? [String: AnyObject] {
                retweeted_status = HMStatus(dict: dict)
            }
            return
        }
        super.setValue(value, forKey: key)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
    }
    
    override var description:String{
        let array = ["id","text","created_at","source","user","pic_urls","retweeted_status"]
        return dictionaryWithValuesForKeys(array).description
    }
}
